﻿@model DirigoEdge.Areas.Admin.Models.ViewModels.EditContentViewModel

<div class="panel settings">
    <h3>Settings</h3>
    
    <div class="saveContainer container">
        <a id="SaveDraftButton" class="button secondary">Save Draft</a>
        <a id="PreviewContentButton" href="/admin/previewcontent/?id=@Model.ThePage.ContentPageId" class="secondary button mobileMarginBottom" target="_blank">Preview</a>
    </div>    

    @{
        bool isActive = Convert.ToBoolean(Model.ThePage.IsActive);
        string formattedDate = isActive ? Convert.ToDateTime(Model.ThePage.PublishDate).ToString("MM/dd/yyyy @ hh:mm") : "(Draft)" ;
        string publishedLabel = isActive ? "Update" : "Publish";
        string statLabel = isActive ? "Published" : "Draft";
    }
    
    
    <a id="SaveContentButton" class="button mobileMarginBottom">@publishedLabel</a>
    <div id="SaveSpinner" class="standaloneSpinner"></div>
    
    <div class="contentStatus container">
        <label>Status : <a id="StatusLabel" href="#">@statLabel</a></label>
        
        <div id="DraftStatusContainer">
            
            @{
                string draftSelected = !isActive ? "selected=selected" : "";
                string pubSelected = isActive ? "selected=selected" : "";
            }

            <select id="DraftStatusSelector" autocomplete="off">
                <option value="draft" @draftSelected>Draft</option>
                <option value="published" @pubSelected>Published</option>
            </select>        
            
            <a id="CloseDraftStatus" href="#">Close</a>

        </div>

        
    </div>

    <div class="publishContainer clearfix container">
        Last Published : <span id="PublishedDate">@formattedDate</span>
    </div>

</div>

<div class="panel template">
    <h3>Template</h3>
    <select id="ContentTemplateSelect">
        @{
            foreach(var template in Model.Templates)
            {
                string templateName = template.Value.TemplateName;
                string selected = template.Key == Model.ThePage.Template ? "selected = selected" : "";
                
                <option @selected value="@template.Key">@templateName</option>
            }            
        }
    </select>
</div>

@{
    string hideSchemaClass = !Model.ShowSchemaSelector ? "hide" : "";
}
<div class="panel @hideSchemaClass">
    <h3>Schema</h3>
                
    <select id="SchemaSelector" autocomplete="off">
                    
        @{
            string noneSelected = (Model.ThePage.SchemaId == null || Model.ThePage.SchemaId <= 0) ? "selected=selected" : "";
        }
        <option data-id="-1" @noneSelected>None</option>
        @{
            foreach (var schema in Model.Schemas)
            {
                string selected = schema.SchemaId == Model.ThePage.SchemaId ? "selected=selected" : "";
                <option @selected data-id="@schema.SchemaId">@schema.DisplayName</option>
            }
        }
    </select>
            
    <div class="panelActions">
        <a id="RefreshSchemaLink" href="#">Refresh <i class="fa fa-refresh"></i></a> | <a id="EditSchemaLink" href="/admin/editschema/@Model.ThePage.SchemaId" target="_blank">Edit Schema <i class="fa fa-external-link"></i></a>
    </div>

</div> 


<div class="panel setMetaInformation">
    <h4>SEO / Meta</h4>
    <a href="javascript:void(0);" data-reveal-id="SEOMetaModal">Set Meta Information</a>
</div>

<div class="panel reviewRevisions">
    <h4>History</h4>
    
    <div id="RevisionsList">
        @Html.Partial("~/Areas/Admin/Views/Shared/Partials/RevisionsListInnerPartial.cshtml", Model.Revisions)
    </div>
</div>